package dungeonElements;

import static org.junit.Assert.assertEquals;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

/**
 * @author Tom Jacobs & Ewoud De Moor
 * @version 3.0
 */
public class TeleportationSquareTest {
	
	public static TeleportationSquare teleportationSquare;
	public static TeleportationSquare otherTeleportationSquare;
	public static TeleportationSquare thirdTeleportationSquare;

	@Before
	public void setUp() throws Exception {
		teleportationSquare = new NormalSquare();
		otherTeleportationSquare = new NormalSquare();
		thirdTeleportationSquare = new NormalSquare();
	}

	@After
	public void tearDown() throws Exception {
	}

	@Test
	public void testSetTeleportationDestination() {
		assertFalse(teleportationSquare.hasTeleportationDestination());
		assertTrue(teleportationSquare.getAllTeleportationDestinations().isEmpty());
		teleportationSquare.setTeleportationDestination(otherTeleportationSquare);
		assertTrue(teleportationSquare.hasTeleportationDestination());
		assertFalse(teleportationSquare.getAllTeleportationDestinations().isEmpty());
		assertTrue(teleportationSquare.getAllTeleportationDestinations().contains(otherTeleportationSquare));
		assertEquals(otherTeleportationSquare,teleportationSquare.getTeleportationDestination());
	}
	
	@Test
	public void testSetMultipleTeleportationDestination() {
		assertFalse(teleportationSquare.hasTeleportationDestination());
		assertTrue(teleportationSquare.getAllTeleportationDestinations().isEmpty());
		teleportationSquare.setTeleportationDestination(otherTeleportationSquare,thirdTeleportationSquare);
		assertTrue(teleportationSquare.hasTeleportationDestination());
		assertFalse(teleportationSquare.getAllTeleportationDestinations().isEmpty());
		assertEquals(2,teleportationSquare.getAllTeleportationDestinations().size());
		assertTrue(teleportationSquare.getAllTeleportationDestinations().contains(otherTeleportationSquare));
		assertTrue(teleportationSquare.getAllTeleportationDestinations().contains(thirdTeleportationSquare));
		TeleportationSquare destination = teleportationSquare.getTeleportationDestination();
		assertTrue(destination.equals(otherTeleportationSquare)||destination.equals(thirdTeleportationSquare));
	}

}
